package com.example.demo.controller;

import com.example.demo.dao.UserDao;
import com.example.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TestController {

    @Autowired
    private UserDao userDao;

    @RequestMapping("/time")
    public String getTime() {
        User user = new User();
        long timeMillis = System.currentTimeMillis();
        user.setCtime(timeMillis);
        userDao.save(user);
        List<User> all = userDao.findAll();
        return all.toString();
    }
}
